import { defineStore } from "pinia";
const LOCAL_SEMESTER_NAME = 'semesterName';
const LOCAL_SEMESTER_ID = 'semesterId';
const semesterName = defineStore("semesterName", {
    state: () => {
      const storedSemesterName = localStorage.getItem(LOCAL_SEMESTER_NAME);
      const storedSemesterId = localStorage.getItem(LOCAL_SEMESTER_ID);
      return {
        currentSemesterId: storedSemesterId,
        currentSemesterName: storedSemesterName || '', 
      };
    },
    actions: {
      changeSemester(val: string,id: any) {
        this.currentSemesterId = id;
        this.currentSemesterName = val;
        localStorage.setItem(LOCAL_SEMESTER_NAME, String(val));
        localStorage.setItem(LOCAL_SEMESTER_ID, String(id));
      },
    },
    getters:{

    },
  });
  export default semesterName;